/* 
 * Modbus mutex for RTU.
 * Copyright (c) 2012  apleilx
 * All rights reserved.
 * no limite
 */

/* ----------------------- Platform includes --------------------------------*/

//#include "osObjects.h"                                        
#include "mbdef.h"  



//如果每个对象只在单一的任务中操作，无需互斥锁

//static osMutexId     MutexObjmbCmd;
//static uint8_t       mbMutexCreated = 0;

//osMutexDef(MBCMD_Mutex);

/*****************************************************************************//*!
*
* @brief   modbus sync mutex creat.
*     
* @param   none
*
* @return  none
*
* @ Pass/ Fail criteria: none
*****************************************************************************/
void mbOsSyncMutexCreat(void){

//    if(!mbMutexCreated)
//        MutexObjmbCmd = osMutexCreate (MutexObjmbCmd);
//    
//    mbMutexCreated = 1;
}

/*****************************************************************************//*!
*
* @brief   modbus sync mutex pend.
*     
* @param   none
*
* @return  none
*
* @ Pass/ Fail criteria: none
*****************************************************************************/
void mbOsSyncMutexPend(void){
    //OSMutexPend (&MutexObjmbCmd, 0,  OS_OPT_PEND_BLOCKING, &cpu_ts, &os_err);
//    osMutexWait(MutexObjmbCmd,1000);
}

/*****************************************************************************//*!
*
* @brief   modbus sync mutex post.
*     
* @param   none
*
* @return  none
*
* @ Pass/ Fail criteria: none
*****************************************************************************/
void mbOsSyncMutexPost(void){

    //OSMutexPost (&MutexObjmbCmd,  OS_OPT_POST_NO_SCHED, &os_err);
//    osMutexRelease(MutexObjmbCmd);
}


/*****************************************************************************//*!
*
* @brief   modbus os delay.
*     
* @param   none
*
* @return  none
*
* @ Pass/ Fail criteria: none
*****************************************************************************/
void mbOsDelay(uint32_t ms){
    //osDelay(ms_ticks(ms));
}

/*****************************************************************************//*!
*
* @brief   modbus sync event post.
*     
* @param   none
*
* @return  none
*
* @ Pass/ Fail criteria: none
*****************************************************************************/
void mb00_event_send(uint16_t event){
   //osSignalSet(tid_mbTask, event);
}
void mb04_event_send(uint16_t event){
   //osSignalSet(tid_mbTask, event);
}
void mb05_event_send(uint16_t event){
   //osSignalSet(tid_mbTask, event);
}
